From 2ee2741e80775ccccac463ff14013330b0e8ea46 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Tue, 6 Mar 2018 00:41:21 +0000 Subject: [PATCH] Error message for package cycles lists the packages in the cycle. --- src/cargo/core/resolver/mod.rs | 4 ++-- tests/testsuite/build.rs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index b5ca6d9cb..402dd42a6 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -1491,8 +1491,8 @@ fn check_cycles(resolve: &Resolve, activations: &Activations) -> CargoResult<()> { // See if we visited ourselves if !visited.insert(id) { - bail!("cyclic package dependency: package `{}` depends on itself", - id); + bail!("cyclic package dependency: package `{}` depends on itself. Cycle (not in order): {:#?}", + id, visited); } // If we've already checked this node no need to recurse again as we'll diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 51b449af5..d7049befa 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -1531,9 +1531,8 @@ fn self_dependency() { .build(); assert_that(p.cargo("build"), execs().with_status(101) - .with_stderr("\ -[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself -")); + .with_stderr_contains("\ +[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself[..]")); } #[test] @@ -2652,9 +2651,9 @@ fn cyclic_deps_rejected() { assert_that(p.cargo("build").arg("-v"), execs().with_status(101) - .with_stderr("\ -[ERROR] cyclic package dependency: package `a v0.0.1 ([..])` depends on itself -")); + .with_stderr_contains("\ +[ERROR] cyclic package dependency: package `a v0.0.1 ([..]") + .with_stderr_contains("[..]depends on itself[..]")); } #[test] -- 2.30.2